package com.xinqi.common.core.enums;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonValue;
import com.xinqi.common.base.enums.BaseEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 用户反馈类型
 *
 * @Author：yyzhen
 * @Package：com.xinqi.common.core.enums
 * @Project：xingqiclass-cloud-plus
 * @name：RotationImageTypeEnum
 * @Date：2023/4/23 11:55
 * @Filename：RotationImageTypeEnum
 */
public enum FeedbackTypeEnum implements BaseEnum {

    OPTIMIZATION_SUGGESTIONS("optimization_suggestions", "优化建议"),

    ABNORMAL_FUNCTION("abnormal_function", "功能异常"),

    USAGE_EXPERIENCE("usage_experience", "使用感受"),

    WANT_TO_ROAST("want_to_roast", "我想吐槽"),

    EXPECTED_FUNCTION("expected_function", "期望功能"),

    OTHER("other", "其他反馈");

    @Getter(onMethod_ = {@JsonValue})
    private final String code;

    @Getter
    private final String describe;

    FeedbackTypeEnum(String code, String describe) {
        this.code = code;
        this.describe = describe;
    }

    @JsonCreator
    public static FeedbackTypeEnum of(String code) {
        return BaseEnum.of(FeedbackTypeEnum.class, code);
    }

    public static List<Map<String, String>> getSelectList() {
        List<Map<String, String>> list = new ArrayList<>();
        for (FeedbackTypeEnum typeEnum : FeedbackTypeEnum.values()) {
            Map<String, String> map = new HashMap<>();
            map.put("code", typeEnum.getCode());
            map.put("describe", typeEnum.getDescribe());
            list.add(map);
        }
        return list;
    }
}
